package com.study.mike.common.utils;

import cn.hutool.json.JSONUtil;
import cn.ofs.api.OfsClient;
import cn.ofs.entity.DefaultRequestDTO;
import cn.ofs.entity.DefaultResponse;
import com.study.mike.common.constants.Constant;

/**
 * 请求签名工具类
 * @author KangHui
 * @Date 2022/9/01 15:20
 */
public class AuthUtil {
    public static DefaultResponse authorization(Object obj) throws Exception {
        // 请求地址
        String url = "";
        DefaultRequestDTO request = new DefaultRequestDTO();
        // 对应的私匙--测试
        request.setAppSecret(Constant.AuthSign.DEV_APP_SECRET);
        request.setAppKey(Constant.AuthSign.DEV_APP_KEY);
        String str = JSONUtil.toJsonStr(obj);
        DefaultResponse response = new OfsClient(request).post(str, url);
        return response;
    }
}
